﻿using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Crowler.Dispatcher.BusinessComponents;
using Crowler.Dispatcher.DataAccess;
using Crowler.Model.CoreComponents;
using Crowler.Model.Dispetcher.BusinessComponents;
using Crowler.Model.Dispetcher.DataAccess;

namespace CoreComponents.Installers
{
    public class DispatcherComponentsInstaller : IWindsorInstaller
    {
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {


            container.Register(
                Classes.FromAssemblyNamed("Crowler.Dispatcher.BusinessService").
                    BasedOn(typeof(IBusinessService<,>)).
                    LifestyleTransient().WithService.Base().
                    Configure(component => component.Named(component.Implementation.Name))
                );

           
            container.Register(
                Component.For<IDiscoverableEntryRepository>().
                    ImplementedBy<DiscoverableEntryRepository>().
                    LifeStyle.Transient
                );

            container.Register(
                Component.For<IDiscoverableEntryBc>().
                    ImplementedBy<DiscoverableEntryBc>().
                    LifeStyle.Transient
                );
            
        }
    }
}
